package apiday02;

public class RegDemo02 {
    public static void main(String[] args) {
       String reg = "Hello[\\d]";
       String rule = "我[草艹操]";
       String s1 = "Hello1";
       String s2 = "Hello2";
       String s3 = "我草";
       String s4 = "我艹";
       System.out.println(s1.matches(reg));
       System.out.println(s2.matches(reg));
       System.out.println(s3.matches(reg));
       System.out.println(s4.matches(reg));
       System.out.println(s3.matches(rule));
       System.out.println(s4.matches(rule));




        /* String reg = "Hello[\\d]";
        String rule = "我[草艹操]";
        String s1 = "Hello1";
        String s2 = "Hello2";
        String s3 = "我草";
        String s4 = "我艹";//数字


        System.out.println(s1.matches(reg));
        System.out.println(s2.matches(reg));
        System.out.println(s3.matches(rule));
        System.out.println(s4.matches(rule));

        */
    }
}
